import Home from '../pages/home/Home'
import Detail from '../pages/detail/Detail'
import Login from '../pages/login/Login'
import NotFound from '../pages/NotFound'
import List from '../pages/list/List'
import Search from '../pages/search/Search'
import { Navigate } from 'react-router-dom'
import AuthRoute from './AuthRoute'


export const routes = [
    {
      path:'/',
      element:<Navigate to='/home'/>
    },
    {
      path:'/home', 
      element:<Home/>,
      children:[
        {
          path:'/home',
          element:<Navigate to='/home/zh'/>
        },
        {
          path:'/home/:id',
          element:<List />
        }
      ] 
    },
      // 动态路由传参数需要先配置
    {
      path:'/detail',
      
      element:(
      <AuthRoute> 
        <Detail />
      </AuthRoute>
    )
    },
      
    {
      path:'/login', 
      element:<Login />
    },
    {
      path:'/search', 
      element:<Search />
    },
    {
      path:'*',
      element:<NotFound />
    } 
  ]